#include<iostream>
#include<string>

using namespace std;

string letters;
int last; 

int getCoding(char a) {
   switch(a) {
      case 'B':
      case 'F':
      case 'P':
      case 'V': return 1;
      case 'C':
      case 'G':
      case 'J':
      case 'K':
      case 'Q':
      case 'S':
      case 'X':
      case 'Z': return 2;
      case 'D': 
      case 'T': return 3;
      case 'L': return 4;
      case 'M':
      case 'N': return 5;
      case 'R': return 6;      
   }
   return -1;
}

void solve() {
   for(int i=0; i<letters.length(); i++) {
      int coding = getCoding(letters[i]);
      if(last == coding)
         continue;
      else if(coding == -1) {
         last = -2;
         continue;
      }
      cout << coding; 
      last = coding;
   }
   cout << endl;
}

void read() {
   while(cin >> letters) {
      last = -2;
      solve();
   }
}

int main() {
   read();
   return 0;
}
